<template>
	<view>
		<view class="tcard">
			<view class="card-title">电子就诊卡</view>
			<view class="center">
				<view class="card--title-bottom"></view>
			</view>
			<view class="center font-weight font-size-20">{{detail.name}}</view>
			<view class="mar-15">
				<view class="flex-start mar-5">
					<view>就诊卡号：</view>
					<view>{{detail.patId}}</view>
				</view>
				<view class="flex-start mar-5">
					<view>证件类型：</view>
					<view>{{detail.certTypeName}}</view>
				</view>
				<view class="flex-start mar-5">
					<view>证件号码：</view>
					<view>{{detail.idCard}}</view>
				</view>
				<view class="flex-start mar-5">
					<view>手机号码：</view>
					<view>{{detail.patPhone}}</view>
				</view>
				<view class="flex-start mar-5">
					<view>联系地址：</view>
					<view>{{detail.province+detail.city+detail.district}}</view>
				</view>
				<view class="flex-start mar-5">
					<view>详细地址：</view>
					<view>{{detail.patAddress}}</view>
				</view>
			</view>
			<view class="pad-32r" v-if="detail.guardian">
				<view class="pad-32r">
					<view class="border-col">监护人</view>
					<view class="flex-start mar-5">
						<view>姓名：</view>
						<view>{{detail.guardian}}</view>
					</view>
					<view class="flex-start mar-5">
						<view>地址：</view>
						<view>{{detail.patAddress}}</view>
					</view>
					<view class="flex-start mar-5">
						<view>手机：</view>
						<view>{{detail.patPhone}}</view>
					</view>
					<view class="flex-start mar-5">
						<view>身份证：</view>
						<view>{{detail.guardianCreNo}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="around mar-15">
			<view class="btn-edit btn" @click="toPage">开具处方</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {}
			}
		},
		onLoad(e) {
			this.detail = e;
			let idCard = this.detail.certId
			let phone = this.detail.patPhone
			this.detail.idCard = idCard.substring(0, 3) + '**********' + idCard.substring(15)
			this.detail.patPhone = phone.substring(0, 3) + '****' + phone.substring(7)
			let guardianCreNo = this.detail.guardianCreNo
			if (guardianCreNo) {
				this.detail.guardianCreNo = guardianCreNo.substring(0, 3) + '**********' + guardianCreNo.substring(15)
			}

		},
		methods: {
			toPage() {
				uni.$u.route('/pages/prescription/Prescription', this.detail);
			}
		}
	}
</script>

<style scoped>
	.tcard {
		margin: 20px;
	}

	.card-title {
		text-align: center;
		font-size: 20px;
	}

	.card--title-bottom {
		border-top: 5px solid blue;
		width: 30px;
		border-radius: 10px;
	}

	.btn {
		padding: 10px 40px;
		border-radius: 30px;
	}

	.btn-cancel {
		border: 1px solid red;
		color: red;
	}

	.btn-edit {
		background: linear-gradient(139deg, #76E1E7 0%, #40CFE6 100%);
		border-radius: 166px 166px 166px 166px;
		font-size: 15px;
		color: #FFFFFF;
	}
</style>